<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/21 17:08
 * Desc:酒店参数验证
 */
class Request_Api_V2_Hotel extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }

    public function get_detail()
    {
        $this->rules = [
            ['product_id', ['not_empty','digit']],
        ];

        return $this;
    }

    public function get_range_price()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['ding_num', ['not_empty', 'digit', $this->rule_min(1)]],
            ['start_date', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['end_date', ['not_empty', $this->rule_date_format('Y-m-d')]],
        ];

        return $this;
    }

    public function get_index_recommend()
    {
        $this->rules = [
            ['pagesize', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }



    public function get_dest_list()
    {
        $this->rules = [
            ['dest_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['page', ['digit', $this->rule_min(0)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_pay_detail()
    {
        $this->rules = [
            ['startdate', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['leavedate', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['suitid', ['not_empty', 'digit', $this->rule_min(1)]],
            ['dingnum', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_everyday_price()
    {
        $this->rules = [
            ['start_time', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['end_time', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['row', ['digit', $this->rule_min(1)]],
            ['together_id', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_hot_hotel()
    {
        $this->rules = [
            ['page', ['digit', $this->rule_min(1)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function hotel_room()
    {
        $this->rules = [
            ['suit_id', ['not_empty','digit', $this->rule_min(1)]],
            ['hotel_id', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_day_suitlist()
    {
        $this->rules = [
            ['day', ['not_empty','digit', $this->rule_min(1)]],
            ['hotel_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['start_time', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['end_time', ['not_empty', $this->rule_date_format('Y-m-d')]],
        ];

        return $this;
    }

    public function get_general_query()
    {
        $this->rules = [
            ['page', ['digit', $this->rule_min(1)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
            ['rank_id', ['digit', $this->rule_min(0)]],
            ['price_id', ['digit', $this->rule_min(0)]],
            ['sorttype', ['digit', $this->rule_min(0)]],
            ['start_time', [$this->rule_date_format('Y-m-d')]],
            ['end_time', [$this->rule_date_format('Y-m-d')]],
        ];

        return $this;
    }

    public function add_order()
    {
        $this->rules = [
            ['product_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['suit_id', ['not_empty', 'digit', $this->rule_min(1)]],
            ['ding_num', ['not_empty', 'digit', $this->rule_min(1)]],
            ['linkman', ['not_empty']],
            ['linktel', ['not_empty', 'phone']],
            ['use_date', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['end_date', ['not_empty', $this->rule_date_format('Y-m-d')]],
        ];
        //自定义规则
        $this->validation->rule('mid',array('Rule_Member','need_member'));
        return $this;
    }
}